<?php
namespace Home\Widget;
use Think\Controller;

class CategoryWidget extends Controller{

//    public function category(){
//
//        //获取文章分类
//          $category_model=M('Category');
//        $ret_category= $category_model->where("status=1")->select();
//
//        $this->assign('category',$ret_category);
//        $this->display('Widget/category');
//    }


    //根据文章id获取分类名称
    public function name($caegory_id){
        $category_model=M('Category');
        $ret_category= $category_model->field('name')->where("id={$caegory_id}")->find();
        echo $ret_category['name'];
    }

}